package test;

import java.sql.DatabaseMetaData;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.logging.StreamHandler;

import org.jplcc.Connection;
import org.jplcc.Driver;
import org.jplcc.DriverManager;
import org.jplcc.PLCMetadata;

import com.sun.xml.internal.ws.api.addressing.WSEndpointReference.Metadata;

public class Main {
	public static void main(String[] args) throws Exception {

		Logger.getLogger("").setLevel(Level.ALL);

		StreamHandler consoleFormatter = new StreamHandler(System.out,
				new SimpleFormatter());
		consoleFormatter.setLevel(Level.ALL);

		// Logger.getLogger("").addHandler(consoleFormatter);

		Connection connection = DriverManager.getConnection("jplcc:memoryplc:test");
		
		PLCMetadata metaData = connection.getMetaData();		
		System.out.println("Major Version: " + metaData.getDriverMajorVersion());
		System.out.println("Minor Version: " + metaData.getDriverMinorVersion());
		System.out.println("Driver Version: " + metaData.getDriverVersion());
		System.out.println("Driver Name: " + metaData.getDriverName());
		System.out.println("PLC Product Name: " + metaData.getPLCProductName());
		System.out.println("Supported Types: " + metaData.getSupportedTypes());
		
		connection.writeBool("test", true);
		connection.writeInteger("test2", 4);
		connection.writeFloats("test3[0]", new float[] { 1.0f, 2.4f });

		System.out.println(connection.readBool("test"));

		connection.close();

		System.exit(0);
	}
}
